package com.uduew.sjd.view.xpop;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatTextView;

import com.uduew.sjd.R;
import com.lxj.xpopup.core.CenterPopupView;

//Acclaim Xpop
public class UserInfoXpop extends CenterPopupView implements View.OnClickListener {
    TextView acclaimRefuseBtn, acclaimAgreeBtn;
    String attitudinize, reflexive;
    private AppCompatTextView tv_name_value;
    private AppCompatTextView tv_card_value;

    public UserInfoXpop(@NonNull Context context, String attitudinize, String reflexive) {
        super(context);
        this.attitudinize = attitudinize;
        this.reflexive = reflexive;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.xpop_user_info;
    }

    @Override
    protected void onCreate() {
        super.onCreate();

        tv_name_value = findViewById(R.id.tv_name_value);
        tv_card_value = findViewById(R.id.tv_card_value);
        tv_name_value.setText(attitudinize);
        tv_card_value.setText(reflexive);

        acclaimRefuseBtn = findViewById(R.id.acclaimRefuse_btn);
        acclaimAgreeBtn = findViewById(R.id.acclaimAgree_btn);
        acclaimRefuseBtn.setOnClickListener(v -> dismiss());
        acclaimAgreeBtn.setOnClickListener(v -> {
            dismiss();
            if (onAgreeClickListener != null) {
                onAgreeClickListener.onAgreeClick();
            }
        });
    }

    @Override
    public void onClick(View v) {
    }

    private OnAgreeClickListener onAgreeClickListener;

    public void setOnAgreeClickListener(OnAgreeClickListener listener) {
        this.onAgreeClickListener = listener;
    }

    public interface OnAgreeClickListener {
        void onAgreeClick();
    }

}